package ExamQuestions;

import java.util.ArrayList;
import java.util.List;

public class Question1 {     //字符集合(暴力解法!)
    public static List<Character> remove(String s) {
        List<Character> list=new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            char ch=s.charAt(i);
            list.add(ch);
        }
        int i=0;
        while(i<list.size()) {
            int j=i+1;
            char ch1=list.get(i);
            while(j<list.size()) {
                char ch2=list.get(j);
                if(ch1==ch2) {
                    list.remove(j);
                    continue;
                }
                j++;
            }
            i++;
        }
        return list;
    }
    public static void main(String[] args) {
        List<Character> ch=remove("abcqwerAcacb");   //输出字符串，要求:重复且靠后的字符不输出
        for (int i = 0; i < ch.size(); i++) {
            System.out.print(ch.get(i));
        }
    }
}
